package com.seanLab.domain;

import java.io.Serializable;
import java.util.List;

/**
 * Created by ailly on 17-8-28.
 */
public class Body implements Serializable{
    private int status;
    private String code;
    private String message;
    private Entity entity;
    //private List<Entity> entities;

    public Body() {
    }

    public Body(int status, String code, String message, Entity entity) {
        this.status = status;
        this.code = code;
        this.message = message;
        this.entity = entity;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Entity getEntity() {
        return entity;
    }

    public void setEntity(Entity entity) {
        this.entity = entity;
    }

    public static Body getResponseBody(int errorType) {
        Body body = null;
        switch (errorType){
            case 0:
                body = new Body(0, "SUCCESS", "成功", null);
                break;
            case 1:
                body = new Body(-1, "AUTH_FAILED", "鉴权失败", null);
                break;
            case 2:
                body = new Body(-1, "DATA_VALID_ERROR", "数据校验错误", null);
                break;

            //Feedback Error Code
            case 20:
                body = new Body(-1, "SESSIONID_VALUE_ERROR", "sessionID值错误", null);
                break;
            case 21:
                body = new Body(-1, "IMGID_VALUE_ERROR", "imgID值错误", null);
                break;
            case 22:
                body = new Body(-1, "TAGID_VALUE_ERROR", "tagID值错误", null);
                break;
            case 23:
                body = new Body(-1, "SCORE_REASON_ERROR", "score或reason值错误", null);
                break;

        }
        return body;
    }


    public static Body getResponseBody(int errorType, Entity entity) {
        Body body = null;
        switch (errorType){
            case 0:
                body = new Body(0, "SUCCESS", "成功", entity);
                break;
        }
        return body;
    }
}
